/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 micro_map_window.h

	$Header: /heroes4/micro_map_window.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( MICRO_MAP_WINDOW_H_INCLUDED )
#define MICRO_MAP_WINDOW_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#pragma warning( disable: 4786 )

#include "bitmap_layer_ptr.h"
#include "counted_ptr.h"
#include "game_window.h"
#include "micro_map_renderer_ptr.h"
#include "micro_map_window_ptr.h"
#include "mini_map_renderer.h"
#include "screen_point.h"
#include "shared_ptr.h"
#include "memory_bitmap.h"

class t_adventure_map;
struct t_map_rect_2d;
class t_micro_map_window;

// --------------------------------------------------------------------------
// t_micro_map_renderer class
// --------------------------------------------------------------------------

class t_micro_map_renderer : public t_counted_object, private t_mini_map_renderer
{
public:
	// Constructor
	t_micro_map_renderer(
		t_adventure_map const &	adventure_map,
		int						level,
		int						team_view,
		t_screen_point const &	view_size,
		t_bitmap_layer_ptr		marker_layer_ptr,
		t_map_rect_2d const &	marker_pos );
	virtual ~t_micro_map_renderer();

private:
	// Data members
	t_shared_ptr< t_memory_bitmap16 >	m_buffer_ptr;
	t_bitmap_layer_ptr				m_marker_layer_ptr;
	t_screen_point					m_marker_pos;
	t_micro_map_window *			m_window_ptr;

	// Member functions
	virtual t_back_buffer_ptr	create_back_buffer( t_screen_point const & size );
	virtual void				on_rect_dirtied( t_screen_rect const & dirtied_rect );
	virtual void				on_view_level_changed( int level );
	virtual void				on_view_resized( t_screen_point const & size );
	void						update( t_screen_rect const & rect );

	friend class t_micro_map_window;
};

// --------------------------------------------------------------------------
// t_micro_map_window class
// --------------------------------------------------------------------------

class t_micro_map_window : public t_window
{
public:
	// Constructor
	explicit t_micro_map_window(
		t_screen_point const &	point,
		t_window *				parent_ptr );
	virtual ~t_micro_map_window();

	// Member functions
	virtual void	paint( t_paint_surface & paint_surface );
	void			set_renderer( t_micro_map_renderer * new_renderer_ptr );

private:
	// Data members
	t_micro_map_renderer_ptr	m_renderer_ptr;

	// Member functions
	void	on_rect_dirtied( t_screen_rect const & dirtied_rect );

	friend class t_micro_map_renderer;
};

#endif // !defined( MICRO_MAP_WINDOW_H_INCLUDED )
